<?php


class HuiyingModel extends BaseModel
{

    var $table  = 'huiying';	

    var $_page_rows = 10;	
	
    /* 插入数据 */
    function post($data)
    {    
	
		$time = time();     
        $data['add_time']=$time;
		return $this->IU_Sql_Exe(array ('data' => $data, 'mode' => 'INSERT'));

        
    }

    function show($table_id='1',$con_id='0',$appname='')
    {  
	     empty($order)?$order = 'add_time desc':'';

		 $conditions = "con_id=".$con_id." and table_id=".$table_id;

	  
	      //分页时，一定是先调用page函数，再调用S_Sql_Exe函数
		 $info['page'] = $this->Page(array('conditions' =>"{$conditions}",'url' => '?app='.$appname.'&act=show&id='.$con_id));		
		 
		 $info['data'] = $this->S_Sql_Exe(array('fields'=> ' * ','conditions' =>"{$conditions}",'order' =>"{$order}",'limit' =>$info['page']['sql_limit']));
    
		 return $info;
   
    }
	


    /* 插入数据 */
    function del($user_id = '',$id ='')
    {      
		return $this->D_Sql_Exe(array ('conditions' =>"user_id = '{$user_id}' and id = '{$id}' "));
        
    }

    /* 修改数据 */
    function editaction($user_id = '',$id ='',$data = '')
    {    
	    $time = time();
		return $this->IU_Sql_Exe(array ('data' => $data,'mode' => 'UPDATE','conditions' =>"user_id = '{$user_id}' and id = '{$id}' "));
        
    }

}








?>